<form id="businessInfo-form" lay-filter="businessInfo-form" class="layui-form model-form">
    <input name="ent_id" type="hidden"/>
    <div class="layui-form-item">
        <label class="layui-form-label">公司名称</label>
        <div class="layui-input-block">
            <input name="name" type="text" class="layui-input"/>
        </div>
    </div>
<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">管理员账号</label>-->
<!--        <div class="layui-input-block">-->
<!--            <input name="username" type="text" class="layui-input"/>-->
<!--        </div>-->
<!--    </div>-->
    <div class="layui-form-item">
        <label class="layui-form-label">管理员姓名</label>
        <div class="layui-input-block">
            <input name="nickname" type="text" class="layui-input"/>
        </div>
    </div>
    <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="business-form-submit" lay-submit>保存</button>
    </div>
</form>

<script>
    layui.use(['layer', 'form', 'admin', 'table'], function () {
        var layer = layui.layer,
            form = layui.form,
            admin = layui.admin;

        var baseData = admin.getTempData('baseData');
        console.log(baseData)
        // 回显数据
        form.val('businessInfo-form', baseData)

        // 表单提交事件
        form.on('submit(business-form-submit)', function (data) {
            admin.req('api-sys/api/enterprise/update', JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, 'PATCH');
            return false;
        })
    })
</script>
